/*
 * @Descripttion: 
 * @version: 
 * @Author: sueRimn
 * @Date: 2022-09-30 16:50:14
 * @LastEditors: sueRimn
 * @LastEditTime: 2022-10-28 15:06:05
 */
const util = require('util');
exports.isEmpty = (str) => {
  String.prototype.trim ? String.prototype.trim : String.prototype.trim =
    function () {
      return this.replace(/^\s+|\s+$/gm, '')
    }
  str = str.trim();
  if (util.isNullOrUndefined(str) || str.length == 0)
    return true;
  else if (util.isArray(str) && str.length == 0) return true;
  else if (util.isObject(str) && JSON.stringify(str) == "{}") return true;
  return false;
}
exports.uuidGenerator = () => {
  let orgStr = 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx',
    orgChar = '0123456789abcdef',
    len = orgChar.length;
  return orgStr.replace(/x/g, function (match) {
    return orgChar.charAt(Math.floor(Math.random() * len))
  })
}